package com.example.mybatis.fluent.db.entity;

import cn.org.atool.fluent.mybatis.annotation.FluentMybatis;
import cn.org.atool.fluent.mybatis.annotation.GmtCreate;
import cn.org.atool.fluent.mybatis.annotation.GmtModified;
import cn.org.atool.fluent.mybatis.annotation.TableField;
import cn.org.atool.fluent.mybatis.annotation.TableId;
import cn.org.atool.fluent.mybatis.base.RichEntity;
import java.util.Date;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

/**
 * SysLogEntity: 数据映射实体定义
 *
 * @author Powered By Fluent Mybatis
 */
@SuppressWarnings({"rawtypes", "unchecked"})
@Data
@Accessors(
    chain = true
)
@EqualsAndHashCode(
    callSuper = false
)
@AllArgsConstructor
@NoArgsConstructor
@FluentMybatis(
    table = "sys_log",
    schema = "zhqj"
)
public class SysLogEntity extends RichEntity {
  private static final long serialVersionUID = 1L;

  @TableId(
      value = "log_id",
      desc = "唯一标识"
  )
  private Long logId;

  @TableField(
      value = "api_method",
      desc = "请求API接口的方式"
  )
  private String apiMethod;

  @TableField(
      value = "api_name",
      desc = "请求的API接口文案说明"
  )
  private String apiName;

  @TableField(
      value = "api_path",
      desc = "请求的API接口路径"
  )
  private String apiPath;

  @TableField(
      value = "bean_method",
      desc = "bean方法"
  )
  private String beanMethod;

  @TableField(
      value = "elapsed_time",
      desc = "消耗时间"
  )
  private Long elapsedTime;

  @TableField(
      value = "params",
      desc = "请求的API参数"
  )
  private String params;

  @TableField(
      value = "user_id",
      desc = "用户ID"
  )
  private Long userId;

  @TableField(
      value = "user_name",
      desc = "用户名称"
  )
  private String userName;

  @TableField(
      value = "create_time",
      insert = "now()",
      desc = "创建时间"
  )
  @GmtCreate
  private Date createTime;

  @TableField(
      value = "update_time",
      insert = "now()",
      update = "now()",
      desc = "更新时间"
  )
  @GmtModified
  private Date updateTime;

  @Override
  public final Class entityClass() {
    return SysLogEntity.class;
  }
}
